package com.becca.cake.model.logistic;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.becca.cake.core.exception.ServiceException;

/**
 * 物流状态信息表
 * @copyright  尊星(上海)信息科技有限公司
 * @author hejinguo
 * @date 2016年4月10日 上午3:00:14
 */
public class LogisticStatusModel implements Serializable {
    /**  */
    private static final long serialVersionUID      = -4552893223323739959L;
    /**订单编号不能为空*/
    public static String      ORDER_ID_NULL         = "订单编号不能为空";

    /**物流编号不能为空*/
    public static String      LOGISTICS_ID_NULL     = "物流编号不能为空";

    /**物流信息不能为空*/
    public static String      LOGISTICS_NAME_NULL   = "物流信息不能为空";

    /**是否对外显示( 1:显示)*/
    public static Byte        LOGISTICS_STATUS_SHOW = 1;
    
    /**sratusName 10:已拒收*/
    public static String      STATUS_NAME_REFUSE   = "已拒收";
    
    /**sratusName 7:已申请退款*/
    public static String      STATUS_NAME_APPLY_BACK_MONEY   = "已申请退款";

    private Integer           id;
    /**订单ID*/
    private Integer           orderId;
    /**订单状态值,包含有：确认中 2:已确认 3:备货中 4:已发货 5:已完成 6:已取消)*/
    private String            statusName;
    /**是否对外显示(0:不显示 1:显示)*/
    private Byte              isShow;
    /**创建时间*/
    private Date              createdDate;
    /**创建人*/
    private String            createdName;

    /**
     * 校验订单信息
     * @param orderId
     */
    public static void validateLogisticParam(Integer orderId) {
        if (orderId == null) {
            throw new ServiceException(LogisticStatusModel.ORDER_ID_NULL);
        }
    }

    /**
     * 修改物流信息
     * @param logisticId
     * @param logisticMessage
     */
    public static void validateOrderLogisticsMessageParam(Integer logisticId, String logisticMessage) {
        if (logisticId == null) {
            throw new ServiceException(LogisticStatusModel.LOGISTICS_ID_NULL);
        }
        if (StringUtils.isEmpty(logisticMessage)) {
            throw new ServiceException(LogisticStatusModel.LOGISTICS_NAME_NULL);
        }
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }

    public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public Byte getIsShow() {
        return isShow;
    }

    public void setIsShow(Byte isShow) {
        this.isShow = isShow;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getCreatedName() {
        return createdName;
    }

    public void setCreatedName(String createdName) {
        this.createdName = createdName;
    }

    @Override
    public String toString() {
        return "LogisticStatusDO [id=" + id + ", orderId=" + orderId + ", statusName=" + statusName
               + ", isShow=" + isShow + ", createdDate=" + createdDate + ", createdName="
               + createdName + "]";
    }

}
